xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler
authorBhupinder Thakur <bhupinder.thakur@linaro.org>
Fri, 29 Sep 2017 05:59:46 +0000 (11:29 +0530)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 29 Sep 2017 18:50:20 +0000 (11:50 -0700)
commitb7ed331353a14f43f53eaf6a3a543ec8385193a3
treec74109050dffe17dce985061f5590792678488cf
parent13dd8da1e3bac9cce193db582f89a48e46fbb026
xen/arm: Fix the issue in cmp_mmio_handler used in find_mmio_handler

This patch fixes the wrong range check done in cmp_mmio_handler().

This function returns -1 , 0 or 1  based on whether the key value
is below the range, in the range or above the range where the range is
(start, start+size). However, it should check against (start, start+size-1)
because start+size falls outside the range.

This resulted in returning a wrong mmio_handler for a given mmio address which
happened to be start+size.

This bug was introduced when the mmio region search switched from
linear search to binary search in the following commit:

8047e09 "xen/arm: io: Use binary search for mmio handler lookup".

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/io.c